﻿using SCG.General;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TTEngine
{
    public class PatternRoom : Room
    {
        //constructor
        public PatternRoom()
            : base()
        {
            Matrix = new CharMatrix(PatternMap);
        }

        //clone
        public override Room Clone()
        {
            return new PatternRoom();
        }

        //the pattern that the room should be based on
        public virtual string PatternMap
        {
            get
            {
                return GeneratePatternMap(4, 12);
            }
        }

        //generate a pattern map of a specified size
        public string GeneratePatternMap(int min, int max)
        {
            int width = Globals.RandomIntFromTo(min, max);
            int height = Globals.RandomIntFromTo(min, max);
            string line = "";
            while (width > 0)
            {
                line += Globals.TERRAIN_FLOOR;
                width--;
            }
            string result = "";
            while (height > 0)
            {
                if (result != "")
                    result += ",";
                result += line;
                height--;
            }
            return result;
        }
    }
}
